import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

export default new Router({
  mode: "hash",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/login",
      name: "login",
      component: () =>
        import(/* webpackChunkName: "login" */ "../components/page/Login"),
      meta: { title: "登录" }
    },
    {
      path: "/403",
      name: "403",
      component: () =>
        import(/* webpackChunkName: "login" */ "../components/page/403"),
      meta: { title: "登录" }
    }
  ]
});
